Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-transform-es2015-typeof-symbol

Package Overview
Dependencies
Maintainers
6
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-es2015-typeof-symbol

This transformer wraps all typeof expressions with a method that replicates native behaviour. (ie. returning “symbol” for symbols)

  • 6.23.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2M
decreased by-30.33%
Maintainers
6
Weekly downloads
 
Created

What is babel-plugin-transform-es2015-typeof-symbol?

The babel-plugin-transform-es2015-typeof-symbol npm package is a plugin for Babel that ensures the behavior of the `typeof` operator is spec-compliant when used with symbols, a new primitive type introduced in ES2015 (ES6). It is part of the Babel's ES2015 preset and is used to transform code so that it can run in environments that do not natively support the new symbol type.

What are babel-plugin-transform-es2015-typeof-symbol's main functionalities?

Transform typeof usage with symbols

This code sample demonstrates how the plugin transforms the `typeof` operator when used with a symbol. The plugin adds a helper function to correctly return 'symbol' when the operand is a symbol.

"use strict";

var _typeof = function (obj) {
  return obj && obj.constructor === Symbol ? "symbol" : typeof obj;
};

var sym = Symbol('foo');
console.log(_typeof(sym) === 'symbol'); // true

Other packages similar to babel-plugin-transform-es2015-typeof-symbol

Keywords

FAQs

Package last updated on 13 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc